import java.util.Random;
public class A7{
	public static void main(String[] agrs){
		 //定义数组求最大值
		 int[] numbers = {25,45,26,53,78};
		 int max = numbers[0];
		 for(int i = 1;i < 5;i++){
			 if(max < numbers[i]){
				 max = numbers[i];
			 }
		 }
		 System.out.println("最大值是"+max);
		 //生成10个1-100之间的随机数存入数组,并统计有多少个数据比平均值小
		 int[] random = new int[10];
		 Random r = new Random();
		 int sum = 0;
		 for(int i = 0;i < 10;i++){
			 random[i] = r.nextInt(100)+1;
		     System.out.print(random[i]+" ");
			 sum += random[i];
		 }
		 System.out.println();
		 int average = sum / random.length;
		 int count = 0;
		 for(int i = 0;i < 10;i++){
			 if(random[i] < average){
				 System.out.print(random[i]+" ");
				 count++;
			 }
		 }
		 System.out.println("一共有"+count+"个数小于平均值");
		 
		 //一个数组存了1,2,3,4,5这五个数,请将它反过来存储
		 int[] numbers1 = {1,2,3,4,5};
		 for(int i = 0,j = numbers.length-1;i < j;i++,j--){
			 int temp = numbers1[i];
			 numbers1[i] = numbers1[j];
			 numbers1[j] = temp;
		 }
		 for(int i = 0;i < numbers1.length;i++){
			 System.out.print(numbers1[i]+" ");
		 }
		 System.out.println();
		 
		 //一个数组存了1,2,3,4,5这五个数,请将它打乱之后存储
		 int[] numbers2 = {1,2,3,4,5};
		 Random r1 = new Random();
		 for(int i = 0;i < numbers2.length;i++){
			 int temp = numbers2[i];
			 int q = r1.nextInt(numbers2.length);
			 numbers2[i] = numbers2[q];
			 numbers2[q] = temp;
		 }
		 for(int i = 0;i < numbers2.length;i++){
			 System.out.print(numbers2[i]+" ");
		 }
	}
}